/**  
 * All rights Reserved, Designed By www.richfit.com
 * @Title:  DataSourceContextHolder.java   
 * @Package cn.eonshine.base.config.mulitdb   
 * @Description:    TODO
 * @author: lanjf2000
 * @date:   2018-10-15 18:28:07
 * @version V1.0 
 * @Copyright: 2018 www.richfit.com Inc. All rights reserved. 
 */
package com.richfit.cuba.web.config.db.mulitdb;

/**
 * @ClassName: DataSourceContextHolder
 * @Description:TODO
 * @author: lanjf2000
 * @date: 2018-10-15 18:28:07
 * 
 * @Copyright: 2018 www.richfit.com Inc. All rights reserved.
 */
public class DataSourceContextHolder {
	private static final ThreadLocal<String> contextHolder = new InheritableThreadLocal<>();

	/**
	 * 
	 * @param db
	 */
	public static void setDataSource(String db) {
		contextHolder.set(db);
	}

	/**
	 * 
	 * @return
	 */
	public static String getDataSource() {
		return contextHolder.get();
	}

	/**
	 */
	public static void clear() {
		contextHolder.remove();
	}
}
